package com.app.business.web.business;

import com.app.business.calculate.CalculateHandInMoneyUtils;
import com.app.business.calculate.CalculateSfUtils;
import com.app.business.model.*;
import com.app.business.service.*;
import com.app.business.utils.AreaAndPriceUtils;
import com.app.business.utils.CalculateDate;
import com.app.business.utils.CareBuyAreaUtils;
import com.app.system.permission.model.DataDict;
import com.app.system.permission.service.DataDictService;
import com.app.system.utils.CollectionUtils;
import com.app.system.utils.ParamUtils;
import com.app.system.utils.dataType.*;
import com.app.system.utils.exception.Precondition;
import com.app.system.utils.pdf.PdfDocumentGenerator;
import com.google.common.collect.Lists;
import com.google.common.collect.Maps;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.io.OutputStream;
import java.lang.reflect.InvocationTargetException;
import java.math.BigDecimal;
import java.util.*;

/**
 * 所有单据、协议pdf打印统一接口
 * Created by lsh on 2019/2/14.
 *
 * @author lsh
 */
@Controller
@RequestMapping("/pdf/print/*")
@SuppressWarnings("all")
public class PdfPrintController {

    @Autowired
    private ContractService contractService;
    @Autowired
    private DataDictService dataDictService;
    @Autowired
    private HouseService houseService;
    @Autowired
    private StorageRoomService storageRoomService;
    @Autowired
    private CarLotService carLotService;
    @Autowired
    private ZsProjectService zsProjectService;
    @Autowired
    private BuyHousePersonService buyHousePersonService;
    @Autowired
    private HouseBuyPersonService houseBuyPersonService;
    @Autowired
    private CarLotBuyPersonService carLotBuyPersonService;
    @Autowired
    private StorageRoomPersonService storageRoomPersonService;
    @Autowired
    private ShopHouseBuyPersonService shopHouseBuyPersonService;
    @Autowired
    private OverAreaPriceNewService overAreaPriceNewService;
    @Autowired
    private OverAreaOneFloorSyPriceService overAreaOneFloorSyPriceService;//一层商业
    @Autowired
    private OverAreaTwoFloorSyPriceService overAreaTwoFloorSyPriceService;//二层商业
    @Autowired
    private OverAreaScPriceService overAreaScPriceService;//商场
    @Autowired
    private OverAreaXzlPriceService overAreaXzlPriceService;//写字楼
    @Autowired
    private HandInMoneyService handInMoneyService;
    @Autowired
    private HousePersonForPropertyService housePersonForPropertyServicese;
    @Autowired
    private AdjustAreaService adjustAreaService;
    @Autowired
    private ShopHouseService shopHouseService;
    @Autowired
    private SyKgInfoService syKgInfoService;

    /**
     * 公共打印方法
     *
     * @param map
     * @param template
     * @param response
     * @throws Exception
     * @throws InvocationTargetException
     * @throws NoSuchMethodException
     * @throws NoSuchFieldException
     * @throws IllegalAccessException
     */
    private void commonPrintPDF(Map map, String template, HttpServletResponse response) throws Exception, InvocationTargetException, NoSuchMethodException, NoSuchFieldException, IllegalAccessException {
        PdfDocumentGenerator pdfDocumentGenerator = new PdfDocumentGenerator();
        OutputStream outputStream = null;
        try {
            response.setHeader("Expires", "0");
            response.setHeader("Cache-Control", "must-revalidate, post-check=0, pre-check=0");
            outputStream = response.getOutputStream();
            pdfDocumentGenerator.generate(template, map, outputStream);
        } catch (IOException e) {

        } finally {

        }
    }

    /**
     * 根据contract自动获取打印模板路径
     * 路径：项目编号/模板
     *
     * @param contract
     * @param templateName
     * @return
     */
    private String getPdfUrl(Contract contract, String templateName) {
        return contract.getTextCode() + "/" + templateName;
    }

    /**
     * 打印房源签认表
     *
     * @param request
     */
    @RequestMapping("chooseResultPDF")
    @RequiresPermissions("print:chooseResultPDF")
    public void chooseResultPDF(HttpServletRequest request, HttpServletResponse response) throws Exception, InvocationTargetException, NoSuchMethodException, NoSuchFieldException, IllegalAccessException {
        Map<String, DataDict> houseTypeMap = this.dataDictService.getMapByParentNameForValue("房屋类型");
        Map<String, DataDict> carLotTypeMap = this.dataDictService.getMapByParentNameForValue("车位类型");
        Map<String, DataDict> houseHoldMap = this.dataDictService.getMapByParentNameForValue("房屋户型");
        Map<String, DataDict> houseNatureMap = this.dataDictService.getMapByParentNameForValue("房源属性");
        Map<String, DataDict> jiesuanTypeMap = this.dataDictService.getMapByParentNameForValue("剩余面积是否结算");
        Map<String, DataDict> isDisPlaceStatusMap = this.dataDictService.getMapByParentNameForValue("置换、申购方式");
        int contractId = ParamUtils.getInt(request, "contractId", 0);
        int type = ParamUtils.getInt(request, "type", 0);
        Contract contract = this.contractService.findOne(contractId);
        Precondition.checkSqdsArguement(contract != null, "数据有误！");
        List<House> houseList = this.houseService.getHouseListByContractId(contractId);
        List<ShopHouse> shopHouseList = this.shopHouseService.getShopHouseListByContractId(contractId);
        List<CarLot> carLotList = this.carLotService.getCarLotListByContractId(contractId);

        List<StorageRoom> storageRoomList = this.storageRoomService.getStorageRoomListByContractId(contractId);
        List<String> careBuyAreaNameList = CareBuyAreaUtils.getCareBuyAreaNameList(contract);
        List<AdjustArea> adjustAreaList = this.adjustAreaService.getAdjustAreaListByContractId(contractId);
        String adjustAreaMemo = "";
        if (CollectionUtils.isNotEmpty(adjustAreaList)) {
            for (AdjustArea adjustArea : adjustAreaList) {
                adjustAreaMemo = adjustAreaMemo + adjustArea.getMemo();
            }
        }

        Map map = Maps.newHashMap();
        map.put("bigUtils", new BigDecimalUtils());
        map.put("intUtils", new IntegerUtils());
        map.put("strUtils", new StringUtils());
        map.put("careBuyAreaNameList", careBuyAreaNameList);//照顾购买名称list
        map.put("adjustAreaMemo", adjustAreaMemo);
        map.put("contract", contract);
        map.put("houseList", houseList);
        map.put("storageRoomList", storageRoomList);
        map.put("carLotList", carLotList);
        map.put("houseTypeMap", houseTypeMap);
        map.put("houseHoldMap", houseHoldMap);
        map.put("houseNatureMap", houseNatureMap);
        map.put("carLotTypeMap", carLotTypeMap);
        map.put("jiesuanTypeMap", jiesuanTypeMap);
        map.put("type", type);
        map.put("shopHouseList",shopHouseList);

        String bsLzMemo = "";
        String bsLzAllMemo = "";
        if (StringUtils.isNotEmpty(contract.getBaoZhangType())) {
            List<String> baoZhangTypeList = Arrays.asList(contract.getBaoZhangType().split(";"));
            for (String s : baoZhangTypeList) {
                bsLzMemo = "";
                if (s.contains("已放弃选择“保障房”")) {
                    if (s.substring(10, 14).equals("0302")) {
                        bsLzMemo = "流转三房二厅：";
                        bsLzMemo = bsLzMemo + org.apache.commons.lang3.StringUtils.substringBetween(s, "的", "被");
                    } else if (s.substring(10, 14).equals("0402")) {
                        bsLzMemo = "流转四房二厅：";
                        bsLzMemo = bsLzMemo + org.apache.commons.lang3.StringUtils.substringBetween(s, "的", "被");
                    }
                    bsLzMemo = bsLzMemo + "<br/>";
                }
                bsLzAllMemo = bsLzAllMemo + bsLzMemo;
            }
        }
        map.put("bsLzAllMemo", bsLzAllMemo);
        String bqDisPlace = "";
        String bqDisPlaceArea = "";
        if (contract.getIsDisplace() != null && contract.getIsDisplace() == 2) {
            BigDecimal qifangZhihuanArea = BigDecimal.ZERO;
            BigDecimal qifangZhihuanAreaAll = BigDecimal.ZERO;
            BigDecimal buyArea = BigDecimal.ZERO;
            BigDecimal buyAreaAll = BigDecimal.ZERO;

            if (CollectionUtils.isNotEmpty(houseList)) {
                for (House house : houseList) {
                    qifangZhihuanArea = BigDecimal.ZERO;
                    buyArea = BigDecimal.ZERO;

                    if (house.getIsDisplace() != null && house.getIsDisplace() == 2) {
                        bqDisPlace = "该户选择" + house.getAzProjectNameAndHouseNumStr() + "的房源建筑面积为" + house.getBuildArea() + "平方米。";
                        if (house.getDisplaceStatus() != null) {
                            bqDisPlace = bqDisPlace + "并且选择该房使用" + isDisPlaceStatusMap.get(house.getDisplaceStatus().toString()).getName() + "的选房方式；其中";
                            if (house.getDisplaceStatus() == 1) {
                                qifangZhihuanArea = house.getDisplaceAreaForAzArea();
                                buyArea = BigDecimal.ZERO;
                                bqDisPlace = bqDisPlace + "应安置面积与该房源户型的建筑面积按1:" + house.getDisplaceAreaBl() + "比例进行置换后得到此房使用的应安置面积为：" + house.getDisplaceAreaForAzArea() + "平方米。";
                                bqDisPlace = bqDisPlace + "该户全部选房面积应为" + house.getBuildAreaForDisplace();
                            } else if (house.getDisplaceStatus() == 2) {
                                qifangZhihuanArea = BigDecimal.ZERO;
                                buyArea = house.getBuyArea();
                                bqDisPlace = bqDisPlace + "应安置面积与该房源户型的建筑面积按1:1进行申购，并在财务结算时按" + house.getBuyPrice() + "元/㎡给予补差价："
                                        + house.getBuyArea() + "*" + house.getBuyPrice() + "=" + house.getBuyAreaMoney() + "。";
                                bqDisPlace = bqDisPlace + "该户全部选房面积应为" + house.getBuildAreaForDisplace();
                            } else if (house.getDisplaceStatus() == 3) {
                                qifangZhihuanArea = house.getDisplaceAreaForAzArea();
                                buyArea = house.getBuyArea();
                                bqDisPlace = bqDisPlace + "应安置面积" + house.getDisplaceAreaForAzArea() + "与该房源户型的建筑面积按1:" + house.getDisplaceAreaBl() + "比例进行置换后得到此房使用置换的建筑面积为：" + house.getDisplaceArea() + "平方米。";
                                bqDisPlace = bqDisPlace + "剩余部分" + house.getBuildArea() + "-" + house.getDisplaceArea() + "=" + house.getBuyArea() + "按1:1进行申购，并在财务结算时按" + house.getBuyPrice() + "元/㎡给予补差价："
                                        + house.getBuyArea() + "*" + house.getBuyPrice() + "=" + house.getBuyAreaMoney() + "；";
                                bqDisPlace = bqDisPlace + "该房全部选房面积应为" + house.getDisplaceAreaForAzArea() + "+" + house.getBuyArea() + "=" + house.getBuildAreaForDisplace() + "。";
                                bqDisPlace = bqDisPlace + "该户全部选房面积应为" + house.getBuildAreaForDisplace();

                            }
                        }
                    } else {
                        bqDisPlaceArea = bqDisPlaceArea + "+" + house.getBuildArea();
                    }
                    qifangZhihuanAreaAll = BigDecimalUtils.getSum(qifangZhihuanAreaAll, qifangZhihuanArea);
                    buyAreaAll = BigDecimalUtils.getSum(buyAreaAll, buyArea);
                }
                if (bqDisPlace != "") {
                    bqDisPlace = bqDisPlace + bqDisPlaceArea + "=" + contract.getChooseHouseAreaTotalForDisplace() + "平方米。";
                }
            }
            map.put("bqDisPlace", bqDisPlace);
            map.put("qifangZhihuanAreaAll", qifangZhihuanAreaAll);
            map.put("buyAreaAll", buyAreaAll);
            map.put("areaAll", BigDecimalUtils.getSum(qifangZhihuanAreaAll, buyAreaAll));

        }


        //房源签认表
        String template = this.getPdfUrl(contract, "chooseResultPDF.html");
        this.commonPrintPDF(map, template, response);

    }

    /**
     * 打印书证材料具结书
     *
     * @param request
     */
    @RequestMapping("paperForJjsPDF")
    public void paperForJjsPDF(HttpServletRequest request, HttpServletResponse response) throws Exception, InvocationTargetException, NoSuchMethodException, NoSuchFieldException, IllegalAccessException {
        int contractId = ParamUtils.getInt(request, "contractId", 0);
        Contract contract = this.contractService.findOne(contractId);
        Precondition.checkSqdsArguement(contract != null, "数据有误！");
        Map map = Maps.newHashMap();
        map.put("contract", contract);
        map.put("bigUtils", new BigDecimalUtils());
        map.put("intUtils", new IntegerUtils());
        map.put("strUtils", new StringUtils());
        String template = this.getPdfUrl(contract, "paperForJjsPrintPDF.html"); //交房通知书
        this.commonPrintPDF(map, template, response);
    }

    /**
     * 财务复核时打印提前交付申请表打印
     *
     * @param request
     */
    @RequestMapping("advanceTakeHousePrintPDF")
    @RequiresPermissions("print:advanceTakeHousePrintPDF")
    public void advanceTakeHousePrintPDF(HttpServletRequest request, HttpServletResponse response) throws Exception, InvocationTargetException, NoSuchMethodException, NoSuchFieldException, IllegalAccessException {
        Map<String, DataDict> houseNatureMap = this.dataDictService.getMapByParentNameForValue("房源属性");

        int contractId = ParamUtils.getInt(request, "contractId", 0);
        String houseIdStr = ParamUtils.getString(request, "houseIdStr", "");
        String carLotIdStr = ParamUtils.getString(request, "carLotIdStr", "");
        String storageRoomIdStr = ParamUtils.getString(request, "storageRoomIdStr", "");
        Contract contract = this.contractService.findOne(contractId);
        Precondition.checkSqdsArguement(contract != null, "数据有误！");
        List<House> houseAllList = Lists.newLinkedList();
        List<House> houseSyList = Lists.newLinkedList();
        List<House> houseList = Lists.newLinkedList();
        List<StorageRoom> storageRoomList = Lists.newLinkedList();
        List<CarLot> carLotList = Lists.newLinkedList();
        BigDecimal syHouseArea = BigDecimal.ZERO;
        houseAllList = this.houseService.getHouseListByContractId(contract.getId());
        if (!CollectionUtils.isEmpty(houseAllList)) {
            for (House house : houseAllList) {
                if (!houseIdStr.contains(house.getId().toString())) {
                    houseSyList.add(house);
                    syHouseArea = BigDecimalUtils.getSum(syHouseArea, house.getBuildArea());
                }
            }
        }

        //如果没有选择，则显示所有房源、储物间、车位
        if (houseIdStr.equals("") && carLotIdStr.equals("") && storageRoomIdStr.equals("")) {
            houseList = this.houseService.getHouseListByContractId(contract.getId());
            storageRoomList = this.storageRoomService.getStorageRoomListByContractId(contract.getId());
            carLotList = this.carLotService.getCarLotListByContractId(contract.getId());
        } else {
            if (houseIdStr.length() > 0) {
                houseList = this.houseService.getHouseListByIds(houseIdStr);
            }
            if (carLotIdStr.length() > 0) {
                carLotList = this.carLotService.getCarLotListByIds(carLotIdStr);
            }
            if (storageRoomIdStr.length() > 0) {
                storageRoomList = this.storageRoomService.getStorageRoomListByIds(storageRoomIdStr);
            }
        }

        Map map = Maps.newHashMap();
        map.put("moneyArea", BigDecimalUtils.getBigAndBigSub(syHouseArea, contract.getZzResultArea()));
        map.put("houseNatureMap", houseNatureMap);
        map.put("contract", contract);
        map.put("houseList", houseList);
        map.put("houseAllList", houseAllList);
        map.put("houseSyList", houseSyList);
        map.put("storageRoomList", storageRoomList);
        map.put("carLotList", carLotList);
        map.put("bigUtils", new BigDecimalUtils());
        map.put("intUtils", new IntegerUtils());
        map.put("strUtils", new StringUtils());
        Map<String, List<Map>> buyHousePersonHouseMap = this.buyHousePersonService.getBuyHousePersonByHouse();
        Map<String, List<Map>> buyHousePersonCarLotMap = this.buyHousePersonService.getBuyHousePersonByCarLot();
        Map<String, List<Map>> buyHousePersonStorageRoomMap = this.buyHousePersonService.getBuyHousePersonByStorageRoom();
        map.put("buyHousePersonHouseMap", buyHousePersonHouseMap);
        map.put("buyHousePersonCarLotMap", buyHousePersonCarLotMap);
        map.put("buyHousePersonStorageRoomMap", buyHousePersonStorageRoomMap);

        //部分交房计算金额
        Map handMoneyMap = CalculateHandInMoneyUtils.calPartTakeHouseMoney(contract, houseList, carLotList);
        map.put("handMoneyMap", handMoneyMap);

        //申请提前交房
//        String template = this.getPdfUrl(contract, "advanceTakeHousePDF.html");
        String template = this.getPdfUrl(contract, "buChongAgreementPrintPDF.html");
        this.commonPrintPDF(map, template, response);
    }


    /**
     * 打印财务结算表
     *
     * @param request
     */
    @RequestMapping("settlementPDF")
    @RequiresPermissions("print:settlementPDF")
    public void settlementPDF(HttpServletRequest request, HttpServletResponse response) throws Exception, InvocationTargetException, NoSuchMethodException, NoSuchFieldException, IllegalAccessException {
        int contractId = ParamUtils.getInt(request, "contractId", 0);
        Contract contract = this.contractService.findOne(contractId);
        Precondition.checkSqdsArguement(contract != null && contract.getZsProject() != null, "数据有误！");
        Map<String, DataDict> jiesuanTypeMap = this.dataDictService.getMapByParentNameForValue("剩余面积是否结算");
        Map<String, Map> overHouseMoneyMoreMap = this.overAreaPriceNewService.getOverHouseMoneyMapForMore(contract);
        Map<String, Map> overHouseMoneyLessMap = this.overAreaPriceNewService.getOverHouseMoneyMapForLess(contract);

        Map map = Maps.newHashMap();
        String gdbzPrice = null;
        if (contract.getIsDoubleMoney() != null && contract.getIsDoubleMoney() == 0) {
            Integer month = CalculateDate.getDatesForMonth(contract.getTkDate(), contract.getChooseHouseDate());
            //住宅临时安置补助费
            if (month > 36) {
                gdbzPrice = BigDecimalUtils.getNotNullStr(BigDecimalUtils.getBigAndBigMul(new BigDecimal("2"), contract.getParameter().getGdbzPrice()));   //发两个月的周转费
            } else {
/*
                gdbzPrice = BigDecimalUtils.getNotNullStr(contract.getParameter().getGdbzPrice());   //发一个月的周转费
*/
            }
        }
        //手动计算
        else {
            //单倍
            if (contract.getIsDoubleMoney() != null && contract.getIsDoubleMoney() == 1) {
/*
                gdbzPrice = BigDecimalUtils.getNotNullStr(contract.getParameter().getGdbzPrice());   //发一个月的周转费
*/
            }
            //双倍
            else if (contract.getIsDoubleMoney() != null && contract.getIsDoubleMoney() == 2) {
                gdbzPrice = BigDecimalUtils.getNotNullStr(BigDecimalUtils.getBigAndBigMul(new BigDecimal("2"), contract.getParameter().getGdbzPrice()));   //发两个月的周转费
            }
        }

        //若储物间正常调换，得到调换后的面积 即：储物间置换面积 = 储物间面积 * 储物间单价 * 应补差价
        BigDecimal storageSubArea = BigDecimal.ZERO; //用来抵储物间的安置面积
        if (!String.valueOf(contract.getBuyStorageRoomType()).equals(null) && contract.getBuyStorageRoomType() == 1) {
            storageSubArea = BigDecimalUtils.getBigAndBigDiv(contract.getStorageRoomArea(), contract.getParameter().getCwjBl(), 2);
        }
        List<AdjustArea> adjustAreaList = this.adjustAreaService.getAdjustAreaListByContractId(contractId);
        String adjustAreaMemo = "";
        if (CollectionUtils.isNotEmpty(adjustAreaList)) {
            for (AdjustArea adjustArea : adjustAreaList) {
                adjustAreaMemo = adjustAreaMemo + adjustArea.getMemo();
            }
        }

        map.put("adjustAreaMemo", adjustAreaMemo);
        map.put("storageSubArea", storageSubArea);
        map.put("bigUtils", new BigDecimalUtils());
        map.put("intUtils", new IntegerUtils());
        map.put("strUtils", new StringUtils());
        map.put("contract", contract);
        map.put("zsProject", contract.getZsProject());
        map.put("parameter", contract.getParameter());
        map.put("gdbzPrice", gdbzPrice);
        map.put("jiesuanTypeMap", jiesuanTypeMap);


        //判断是否只有单扩购或者单回购一种情况，并且只结算的情况下
        if (contract.getAzType().contains("商业")){
            map.put("overHouseMoneyLessMap", null);
            map.put("overHouseMoneyMap", null);
            map.put("overHouseMoneySpecialMap", null);
        } else {
            if (contract.getIsJiSuan() == 1 && contract.getZzResultAreaStatus() != null && contract.getZzResultAreaStatus() == 1) {
                //如果使用之前的方案，则只使用扩购
                if (contract.getParameter().getId() < 81) {
                    map.put("overHouseMoneyMap", overHouseMoneyMoreMap);
                    map.put("overHouseMoneyLessMap", null);
                    map.put("overHouseMoneySpecialMap", null);
                } else {
                    //否则
                    //如果扩购，只有扩购区间
                    if (contract.getZzResultArea() != null && contract.getZzResultArea().compareTo(BigDecimal.ZERO) >= 0) {
                        map.put("overHouseMoneyMap", overHouseMoneyMoreMap);
                        map.put("overHouseMoneyLessMap", overHouseMoneyLessMap);
                        map.put("overHouseMoneySpecialMap", null);
                    } else {
                        //否则回购
                        //回购如果回购单价不为区间的话,为固定值，则扩购回购都为空
                        if (contract.getParameter().getXfbcPrice() != null && contract.getParameter().getXfbcPrice().compareTo(BigDecimal.ZERO) > 0) {
                            map.put("overHouseMoneyMap", overHouseMoneyMoreMap);
                            map.put("overHouseMoneyLessMap", null);
                            map.put("overHouseMoneySpecialMap", null);
                            map.put("overHouseMoneyLessMap", overHouseMoneyLessMap);

                        } else {
                            //否则，只有回购
                            map.put("overHouseMoneyMap", overHouseMoneyMoreMap);
                            map.put("overHouseMoneyLessMap", overHouseMoneyLessMap);
                            map.put("overHouseMoneySpecialMap", null);
                        }
                    }

                }
                //可能存在先回购，再扩购的情况
            } else if (contract.getIsJiSuan() == 1 && contract.getZzResultAreaStatus() != null && contract.getZzResultAreaStatus() == 2) {
                Map<String, Map> overHouseMoneySpecialMap = this.overAreaPriceNewService.getOverHouseMoneySpecialMap(contract);

                map.put("overHouseMoneyLessMap", null);
                map.put("overHouseMoneyMap", null);
                map.put("overHouseMoneySpecialMap", overHouseMoneySpecialMap);
            }else if (contract.getIsJiSuan() == 2|| contract.getIsJiSuan()==3){
                map.put("overHouseMoneyMap", overHouseMoneyMoreMap);
                map.put("overHouseMoneyLessMap", null);
                map.put("overHouseMoneySpecialMap", null);
            }
        }

        //期房部分备注
        Map cwMemoMap = CalculateHandInMoneyUtils.calQiHouseMoney(contract);
        map.put("cwMemoMap", cwMemoMap);
        if (contract.getAzType().contains("商业")) {
            map.put("gwjXianFangMoneyMap", null);
            map.put("gwjQiFangMoneyMap", null);
        } else {
            if (contract.getParameter().getGwjHouseNowBl() != null && contract.getParameter().getGwjHouseNowBl().compareTo(BigDecimal.ZERO) > 0) {
                //公维金展示
                Map gwjMoneyMap = CalculateHandInMoneyUtils.calGwjMoney(contract);
                map.put("gwjXianFangMoneyMap", gwjMoneyMap.get("现房"));
                map.put("gwjQiFangMoneyMap", gwjMoneyMap.get("期房"));
            }
        }
        //2024年7月18日 后公维金展示标准 【通过征收项目Id处理】
        List<Map> houseGwjMap = this.houseService.getHouseGwjMap(contractId);
        map.put("houseGwjMap",houseGwjMap);
        map.put("zsProjectId",contract.getZsProject().getId());
        Map<String, DataDict> houseNatureMap = this.dataDictService.getMapByParentNameForValue("房源属性");
        map.put("houseNatureMap",houseNatureMap);

        List<Map> shopHouseGwjMap = this.shopHouseService.getShopHouseGwjMap(contractId);
        map.put("shopHouseGwjMap",shopHouseGwjMap);

        List<House> houseList = this.houseService.getHouseListByContractId(contractId);
        List<ShopHouse> shopHouseList = this.shopHouseService.getShopHouseListByContractId(contractId);
        List<CarLot> carLotList = this.carLotService.getCarLotListByContractId(contractId);
        map.put("houseList",houseList);
        map.put("shopHouseList",shopHouseList);
        map.put("carLotList",carLotList);

        /*商业扩购*/
        //商业店面扩购
        Map<String, Map> overHouseOneSyMoneyMoreMap = this.overAreaOneFloorSyPriceService.getOverHouseMoneyMapForMore(contract);
        //二层商业扩购
        Map<String, Map> overHouseTwoSyMoneyMoreMap = this.overAreaTwoFloorSyPriceService.getOverHouseMoneyMapForMore(contract);
        //商业商场扩购
        Map<String, Map> overHouseSyScMoneyMoreMap = this.overAreaScPriceService.getOverHouseMoneyMapForMore(contract);
        //写字楼扩购
        Map<String, Map> overHouseXzlMoneyMoreMap = this.overAreaXzlPriceService.getOverHouseMoneyMapForMore(contract);
        map.put("overHouseOneSyMoneyMoreMap",overHouseOneSyMoneyMoreMap);
        map.put("overHouseTwoSyMoneyMoreMap",overHouseTwoSyMoneyMoreMap);
        map.put("overHouseSyScMoneyMoreMap",overHouseSyScMoneyMoreMap);
        map.put("overHouseXzlMoneyMoreMap",overHouseXzlMoneyMoreMap);
        List<SyKgInfo> syKgInfoList = new LinkedList<>();
        if (contract.getParameter() == null) {
            syKgInfoList = new LinkedList<>();
        } else {
            syKgInfoList = this.syKgInfoService.getSyKgInfoListByParameterId(contract.getParameter().getId());
        }
        map.put("syKgInfoList",syKgInfoList);

        //财务结算表
        String template = this.getPdfUrl(contract, "settlementPDF.html");
        this.commonPrintPDF(map, template, response);
    }

    /**
     * 打印缴款清单
     *
     * @param request
     */
    @RequestMapping("paymentPDF")
    @RequiresPermissions("print:paymentPDF")
    public void paymentPDF(HttpServletRequest request, HttpServletResponse response) throws
            Exception, InvocationTargetException, NoSuchMethodException, NoSuchFieldException, IllegalAccessException {
        int contractId = ParamUtils.getInt(request, "contractId", 0);
        Contract contract = this.contractService.findOne(contractId);
        Precondition.checkSqdsArguement(contract != null, "数据有误！");
        Map map = Maps.newHashMap();
        map.put("contract", contract);
        map.put("bigUtils", new BigDecimalUtils());
        map.put("intUtils", new IntegerUtils());
        map.put("strUtils", new StringUtils());

        //缴款清单
        String template = this.getPdfUrl(contract, "paymentPDF.html");
        this.commonPrintPDF(map, template, response);
    }

    /**
     * 打印交房通知书
     *
     * @param request
     */
    @RequestMapping("takeHousePrintPDF")
    @RequiresPermissions("print:takeHousePrintPDF")
    public void takeHousePrintPDF(HttpServletRequest request, HttpServletResponse response) throws
            Exception, InvocationTargetException, NoSuchMethodException, NoSuchFieldException, IllegalAccessException {
        int contractId = ParamUtils.getInt(request, "contractId", 0);
        Contract contract = this.contractService.findOne(contractId);
        List<String> personNameList = this.buyHousePersonService.getHouseNameList(contract.getId(), 2);
        Precondition.checkSqdsArguement(contract != null, "数据有误！");
        Map map = Maps.newHashMap();
        map.put("personNameList", personNameList);
        map.put("contract", contract);
        map.put("strUtils", new StringUtils());
        String template = this.getPdfUrl(contract, "takeHousePDF.html"); //交房通知书
        this.commonPrintPDF(map, template, response);
    }

    /**
     * 打印交房告知书
     *
     * @param request
     */
    @RequestMapping("takeHouseGZPDF")
    @RequiresPermissions("print:takeHouseGZPDF")
    public void takeHouseGZPDF(HttpServletRequest request, HttpServletResponse response) throws
            Exception, InvocationTargetException, NoSuchMethodException, NoSuchFieldException, IllegalAccessException {
        int contractId = ParamUtils.getInt(request, "contractId", 0);
        Contract contract = this.contractService.findOne(contractId);
        Precondition.checkSqdsArguement(contract != null, "数据有误！");
        Map map = Maps.newHashMap();
        List<String> personNameList = this.buyHousePersonService.getHouseNameList(contract.getId(), 1);

        if (contract.getChooseHouseDate() != null) {
            int days = DateUtils.getDaysByDateAndDate(contract.getZsProject().getTakeHouseDate(), DateUtils.stringToDateDefault(DateUtils.dateToStringDefault(contract.getChooseHouseDate())));
            Date date = DateUtils.getDateByDateAndDays(contract.getZsProject().getTakeHouseDate(), days);
            map.put("dateStr", DateUtils.dateToStringFormat(date, "yyyy年MM月dd日"));
        }
        map.put("personNameList", personNameList);
        map.put("contract", contract);
        map.put("strUtils", new StringUtils());
        String template = this.getPdfUrl(contract, "takeHouseGZPDF.html"); //交房通知书
        this.commonPrintPDF(map, template, response);
    }

    /**
     * 打印继承具结文本
     *
     * @param request
     */
    @RequestMapping("houseInheritPDF")
    @RequiresPermissions("print:houseInheritPDF")
    public void houseInheritPDF(HttpServletRequest request, HttpServletResponse response) throws
            Exception, InvocationTargetException, NoSuchMethodException, NoSuchFieldException, IllegalAccessException {
        int contractId = ParamUtils.getInt(request, "contractId", 0);
        Contract contract = this.contractService.findOne(contractId);
        Precondition.checkSqdsArguement(contract != null, "数据有误！");
        Map map = Maps.newHashMap();
        map.put("contract", contract);
        map.put("strUtils", new StringUtils());
        String template = this.getPdfUrl(contract, "houseInheritPDF.html"); //交房通知书
        this.commonPrintPDF(map, template, response);
    }


    /**
     * 打印赠与具结文本
     *
     * @param request
     */
    @RequestMapping("houseGiftPDF")
    @RequiresPermissions("print:houseGiftPDF")
    public void houseGiftPDF(HttpServletRequest request, HttpServletResponse response) throws
            Exception, InvocationTargetException, NoSuchMethodException, NoSuchFieldException, IllegalAccessException {
        int contractId = ParamUtils.getInt(request, "contractId", 0);
        Contract contract = this.contractService.findOne(contractId);
        Precondition.checkSqdsArguement(contract != null, "数据有误！");
        Map map = Maps.newHashMap();
        map.put("contract", contract);
        map.put("strUtils", new StringUtils());
        String template = this.getPdfUrl(contract, "houseGiftPDF.html"); //交房通知书
        this.commonPrintPDF(map, template, response);
    }

    /**
     * 打印缴款通知书
     *
     * @param request
     */
    @RequestMapping("handInMoneyPrintPDF")
    @RequiresPermissions("print:handInMoneyPrintPDF")
    public void handInMoneyPrintPDF(HttpServletRequest request, HttpServletResponse response) throws
            Exception, InvocationTargetException, NoSuchMethodException, NoSuchFieldException, IllegalAccessException {
        int contractId = ParamUtils.getInt(request, "contractId", 0);
        Contract contract = this.contractService.findOne(contractId);
        Precondition.checkSqdsArguement(contract != null, "数据有误！");
        Map map = Maps.newHashMap();
        map.put("contract", contract);
        map.put("strUtils", new StringUtils());
        map.put("bigUtils", new BigDecimalUtils());
        String template = "";
//        if (contract.getZsProject().getId() == 8) {
        if (        Arrays.asList(8, 10).contains(contract.getZsProject().getId())) {
            template = this.getPdfUrl(contract, "handInMoneyYzPDF.html"); //缴款通知书
        } else {
            template = this.getPdfUrl(contract, "handInMoneyPDF.html"); //缴款通知书
        }
        this.commonPrintPDF(map, template, response);
    }

    /**
     * 选房通知单pdf打印
     *
     * @param request
     */
    @RequestMapping("batchChooseNoticePrintPDF")
    @RequiresPermissions("print:batchChooseNoticePrintPDF")
    public void batchChooseNoticePrintPDF(HttpServletRequest request, HttpServletResponse response) throws
            Exception, InvocationTargetException, NoSuchMethodException, NoSuchFieldException, IllegalAccessException {
        int type = ParamUtils.getInt(request, "type", 0);
        String preChooseDate = ParamUtils.getString(request, "preChooseDate", "");
        int zsProjectId = ParamUtils.getInt(request, "zsProjectId", 0);
        int contractId = ParamUtils.getInt(request, "contractId", 0);
        Map<String, DataDict> betweenChooseDateMap = this.dataDictService.getMapByParentNameForValue("安排选房时间段");

        Contract contract = null;
        List<Contract> contractList = new ArrayList<>();//待打印的基础信息list
        if (type == 1) {//单独打印
            contract = this.contractService.findOne(contractId);
            Precondition.checkSqdsArguement(contract != null, "数据错误，请重试！");
            contractList.add(contract);
        } else if (type == 2) {
            Precondition.checkSqdsArguement(zsProjectId != 0, "数据错误!");
        }

        if (StringUtils.isNotEmpty(preChooseDate)) {//批量打印
            contractList = this.contractService.getContractListByZsProjectIdAndPreChooseDate(zsProjectId, preChooseDate);
        }

        Precondition.checkSqdsArguement(contractList.size() > 0, "无协议!");
        DateUtils dateUtils = new DateUtils();

        Map map = Maps.newHashMap();
        map.put("contractList", contractList);
        map.put("dateUtils", dateUtils);
        map.put("strUtils", new StringUtils());
        map.put("betweenChooseDateMap", betweenChooseDateMap);

        String template = this.getPdfUrl(contractList.get(0), "batchChooseNoticePrintPDF.html"); //选房通知单模板
        this.commonPrintPDF(map, template, response);
    }

    /**
     * 安置协议打印1
     *
     * @param request
     */
    @RequestMapping("resetAgreementPrintPDF1")
    @RequiresPermissions("print:resetAgreementPrintPDF1")
    public void resetAgreementPrintPDF1(HttpServletRequest request, HttpServletResponse response) throws
            Exception, InvocationTargetException, NoSuchMethodException, NoSuchFieldException, IllegalAccessException {
        int contractId = ParamUtils.getInt(request, "contractId", 0);
        Contract contract = this.contractService.findOne(contractId);
        Precondition.checkSqdsArguement(contract != null, "数据有误！");
        Map map = Maps.newHashMap();
        map.put("contract", contract);
        map.put("strUtils", new StringUtils());
        map.put("intUtils", new IntegerUtils());

        String template = this.getPdfUrl(contract, "resetAgreementPrintPDF1.html");
        this.commonPrintPDF(map, template, response);
    }

    /**
     * 安置协议打印2
     *
     * @param request
     */
    @RequestMapping("resetAgreementPrintPDF2")
    @RequiresPermissions("print:resetAgreementPrintPDF2")
    public void resetAgreementPrintPDF2(HttpServletRequest request, HttpServletResponse response) throws
            Exception, InvocationTargetException, NoSuchMethodException, NoSuchFieldException, IllegalAccessException {
        int houseId = ParamUtils.getInt(request, "houseId", 0);
        House house = this.houseService.findOne(houseId);
        Precondition.checkSqdsArguement(house != null && house.getAzProject() != null, "房源数据有误！");
        Contract contract = house.getContract();
        Precondition.checkSqdsArguement(contract != null, "数据有误！");
        StorageRoom storageRoom = this.storageRoomService.getStorageRoomByHouseId(house.getId());
        storageRoom = storageRoom == null ? new StorageRoom() : storageRoom;
        List<String> ids = this.houseBuyPersonService.getBuyHousePersonIdListByHouseId(house.getId());
        List<BuyHousePerson> buyHousePersonList = new ArrayList<>();
        if (ids.size() != 0) {
            buyHousePersonList = this.buyHousePersonService.getBuyHousePersonListByBuyHousePersonId(ids, contract.getId());
        }
        Map<String, String> townMap = this.dataDictService.getMapByParentNameForValue_Name("乡镇");
        Map map = Maps.newHashMap();
        map.put("size", ids.size());
        map.put("buyHousePersonList", buyHousePersonList);
        map.put("contract", contract);
        map.put("townMap", townMap);
        map.put("house", house);
        map.put("azProject", house.getAzProject());
        map.put("storageRoom", storageRoom);
        map.put("strUtils", new StringUtils());
        map.put("bigUtils", new BigDecimalUtils());

        String template = this.getPdfUrl(contract, "resetAgreementPrintPDF2.html");
        this.commonPrintPDF(map, template, response);
    }

    /**
     * 土地房屋征收补偿确认书
     *
     * @param request
     */
    @RequestMapping("landHouseBcQrsPDF")
    public void landHouseBcQrsPDF(HttpServletRequest request, HttpServletResponse response) throws
            Exception, InvocationTargetException, NoSuchMethodException, NoSuchFieldException, IllegalAccessException {
        int contractId = ParamUtils.getInt(request, "contractId", 0);
        Contract contract = this.contractService.findOne(contractId);
        List<House> houseList = this.houseService.getHouseListByContractId(contract.getId());
        List<CarLot> carLotList = this.carLotService.getCarLotListByContractId(contract.getId());
        List<ShopHouse> shopHouseList = this.shopHouseService.getShopHouseListByContractId(contract.getId());
        Precondition.checkSqdsArguement(contract != null, "数据有误！");

        StringBuffer contractCodeListStr = new StringBuffer(" ");
        int indexZz = 0;
        if (CollectionUtils.isNotEmpty(houseList)) {
            for (House house : houseList) {
                indexZz = indexZz++;
                if (indexZz != houseList.size() + carLotList.size()) {
                    contractCodeListStr.append("住宅").append(contract.getContractCode()).append(house.getContractCodeZzAddCal()).append("、");
                } else {
                    contractCodeListStr.append("住宅").append(contract.getContractCode()).append(house.getContractCodeZzAddCal());
                }
            }
        }

        if (CollectionUtils.isNotEmpty(carLotList)) {
            for (CarLot carLot : carLotList) {
                indexZz = indexZz++;
                if (indexZz != houseList.size() + carLotList.size()) {
                    contractCodeListStr.append("车位").append(contract.getContractCode()).append(carLot.getContractCodeCarCarAddCal()).append("、");
                } else {
                    contractCodeListStr.append("车位").append(contract.getContractCode()).append(carLot.getContractCodeCarCarAddCal());
                }
            }
        }

        if (CollectionUtils.isNotEmpty(shopHouseList)) {
            for (ShopHouse shopHouse : shopHouseList) {
                indexZz = indexZz++;
                if (indexZz != houseList.size() + shopHouseList.size()) {
                    contractCodeListStr.append("店面").append(contract.getContractCode()).append(shopHouse.getContractCodeShopAddCal()).append("、");
                } else {
                    contractCodeListStr.append("店面").append(contract.getContractCode()).append(shopHouse.getContractCodeShopAddCal());
                }
            }
        }

        String contractCodeListString = " ";
        char lastStr = '、';
        if (contractCodeListStr.charAt(contractCodeListStr.length() - 1) == lastStr ) {
            contractCodeListString = contractCodeListStr.substring(0, contractCodeListStr.length() - 1);
        }

        Map map = Maps.newHashMap();
        map.put("contract", contract);
        map.put("strUtils", new StringUtils());
        map.put("intUtils", new IntegerUtils());
        map.put("bigUtils", new BigDecimalUtils());
        map.put("houseList",houseList);
        map.put("carLotList",carLotList);
        map.put("shopHouseList",shopHouseList);
        map.put("contractCodeListStr",contractCodeListString);
        CalculateSfUtils.main(contract.getId());
        String template = this.getPdfUrl(contract, "landHouseBcQrsPDF.html");
        this.commonPrintPDF(map, template, response);
    }
    /**
     * 单选储物间打印
     *
     * @param request
     */
    @RequestMapping("storageRoomPrintPDF")
    @RequiresPermissions("print:storageRoomPrintPDF")
    public void storageRoomPrintPDF(HttpServletRequest request, HttpServletResponse response) throws
            Exception, InvocationTargetException, NoSuchMethodException, NoSuchFieldException, IllegalAccessException {
        int storageRoomId = ParamUtils.getInt(request, "storageRoomId", 0);
        StorageRoom storageRoom = this.storageRoomService.findOne(storageRoomId);
        Precondition.checkSqdsArguement(storageRoom != null && storageRoom.getAzProject() != null, "房源数据有误！");
        Contract contract = storageRoom.getContract();
        Precondition.checkSqdsArguement(contract != null, "数据有误！");
        List<String> ids = this.storageRoomPersonService.getBuyHousePersonIdListByStorageRoomId(storageRoom.getId());
        List<BuyHousePerson> buyHousePersonList = new ArrayList<>();
        if (ids.size() != 0) {
            buyHousePersonList = this.buyHousePersonService.getBuyHousePersonListByBuyHousePersonId(ids, contract.getId());
        }
        Map<String, String> townMap = this.dataDictService.getMapByParentNameForValue_Name("乡镇");
        Map map = Maps.newHashMap();
        map.put("contract", contract);
        map.put("size", ids.size());
        map.put("townMap", townMap);
        map.put("buyHousePersonList", buyHousePersonList);
        map.put("azProject", storageRoom.getAzProject());
        map.put("storageRoom", storageRoom);
        map.put("strUtils", new StringUtils());
        map.put("bigUtils", new BigDecimalUtils());

        String template = this.getPdfUrl(contract, "storageRoomPrintPDF.html");
        this.commonPrintPDF(map, template, response);
    }

    /**
     * 店面打印
     *
     * @param request
     */
    @RequestMapping("shopHousePrintPDF")
/*
    @RequiresPermissions("print:shopHousePrintPDF")
*/
    public void shopHousePrintPDF(HttpServletRequest request, HttpServletResponse response) throws
            Exception, InvocationTargetException, NoSuchMethodException, NoSuchFieldException, IllegalAccessException {
        int shopHouseId = ParamUtils.getInt(request, "shopHouseId", 0);
        ShopHouse shopHouse = this.shopHouseService.findOne(shopHouseId);
        Precondition.checkSqdsArguement(shopHouse != null && shopHouse.getAzProject() != null, "房源数据有误！");
        Contract contract = shopHouse.getContract();
        Precondition.checkSqdsArguement(contract != null, "数据有误！");
        List<String> ids = this.shopHouseBuyPersonService.getBuyHousePersonIdListByShopHouseId(shopHouse.getId());
        List<BuyHousePerson> buyHousePersonList = new ArrayList<>();
        if (ids.size() != 0) {
            buyHousePersonList = this.buyHousePersonService.getBuyHousePersonListByBuyHousePersonId(ids, contract.getId());
        }
        Map<String, String> townMap = this.dataDictService.getMapByParentNameForValue_Name("乡镇");
        Map map = Maps.newHashMap();
        map.put("contract", contract);
        map.put("size", ids.size());
        map.put("townMap", townMap);
        map.put("buyHousePersonList", buyHousePersonList);
        map.put("azProject", shopHouse.getAzProject());
        map.put("shopHouse", shopHouse);
        map.put("strUtils", new StringUtils());
        map.put("bigUtils", new BigDecimalUtils());

        String template = this.getPdfUrl(contract, "shopHousePDF.html");
        this.commonPrintPDF(map, template, response);
    }


    /**
     * 车位使用权买卖协议打印
     *
     * @param request
     */
    @RequestMapping("carLotPrintPDF")
    @RequiresPermissions("print:carLotPrintPDF")
    public void carLotPrintPDF(HttpServletRequest request, HttpServletResponse response) throws
            Exception, InvocationTargetException, NoSuchMethodException, NoSuchFieldException, IllegalAccessException {
        int carId = ParamUtils.getInt(request, "carId", 0);
        CarLot carLot = this.carLotService.findOne(carId);
        Precondition.checkSqdsArguement(carLot != null, "房源数据有误！");
        Contract contract = carLot.getContract();
        Precondition.checkSqdsArguement(contract != null, "数据有误！");
        Map<String, DataDict> carLotTypeMap = this.dataDictService.getMapByParentNameForValue("车位类型");
        Map<String, String> townMap = this.dataDictService.getMapByParentNameForValue_Name("乡镇");
        List<String> ids = this.carLotBuyPersonService.getBuyHousePersonIdListByCarLotId(carLot.getId());
        List<BuyHousePerson> buyHousePersonList = new ArrayList<>();
        if (ids.size() != 0) {
            buyHousePersonList = this.buyHousePersonService.getBuyHousePersonListByBuyHousePersonId(ids, contract.getId());
        }
        Map map = Maps.newHashMap();
        map.put("size", ids.size());
        map.put("buyHousePersonList", buyHousePersonList);
        map.put("contract", contract);
        map.put("townMap", townMap);
        map.put("carLot", carLot);
        map.put("carLotTypeMap", carLotTypeMap);
        map.put("strUtils", new StringUtils());
        map.put("bigUtils", new BigDecimalUtils());
        map.put("intUtils", new IntegerUtils());
        String template = "";
        if (carLot.getCarLotType() != null) {
            template = this.getPdfUrl(contract, "carLotPrintPDF.html");
            /*if (carLot.getCarLotType() == 4 || carLot.getCarLotType() == 5 || carLot.getCarLotType() == 6 || carLot.getCarLotType() == 8) {
                template = this.getPdfUrl(contract, "carLotPrintLeasePDF.html");
            }*/
        }
        this.commonPrintPDF(map, template, response);
    }

    /**
     * 选房安置告知书
     *
     * @param request
     */
    @RequestMapping("chooseHouseGzPDF")
    @RequiresPermissions("print:chooseHouseGzPDF")
    public void chooseHouseGzPDF(HttpServletRequest request, HttpServletResponse response) throws
            Exception, InvocationTargetException, NoSuchMethodException, NoSuchFieldException, IllegalAccessException {
        int type = ParamUtils.getInt(request, "type", 0);
        String preChooseDate = ParamUtils.getString(request, "preChooseDate", "");
        int zsProjectId = ParamUtils.getInt(request, "zsProjectId", 0);
        int contractId = ParamUtils.getInt(request, "contractId", 0);

        Contract contract = null;
        List<Contract> contractList = new ArrayList<>();//待打印的基础信息list
        if (type == 1) {//单独打印
            contract = this.contractService.findOne(contractId);
            Precondition.checkSqdsArguement(contract != null, "数据错误，请重试！");
            contractList.add(contract);
        } else if (type == 2) {
            Precondition.checkSqdsArguement(zsProjectId != 0, "数据错误!");
        }

        if (StringUtils.isNotEmpty(preChooseDate)) {//批量打印
            contractList = this.contractService.getContractListByZsProjectIdAndPreChooseDate(zsProjectId, preChooseDate);
        }

        Precondition.checkSqdsArguement(contractList.size() > 0, "无协议!");
        Map map = Maps.newHashMap();
        map.put("contractList", contractList);
        map.put("strUtils", new StringUtils());
        String template = this.getPdfUrl(contractList.get(0), "chooseHouseGzBillPDF.html");
        this.commonPrintPDF(map, template, response);
    }

    /**
     * 选房安置资格审查表打印
     *
     * @param request
     */
    @RequestMapping("chooseHouseReviewTablePDF")
    @RequiresPermissions("print:chooseHouseReviewTablePDF")
    public void chooseHouseReviewTablePDF(HttpServletRequest request, HttpServletResponse response) throws
            Exception, InvocationTargetException, NoSuchMethodException, NoSuchFieldException, IllegalAccessException {
        Map<String, DataDict> groupMap = this.dataDictService.getMapByParentNameForValue("组别");
        int type = ParamUtils.getInt(request, "type", 0);
        String preChooseDate = ParamUtils.getString(request, "preChooseDate", "");
        int zsProjectId = ParamUtils.getInt(request, "zsProjectId", 0);
        int contractId = ParamUtils.getInt(request, "contractId", 0);

        Contract contract = null;
        List<Contract> contractList = new ArrayList<>();//待打印的基础信息list
        if (type == 1) {//单独打印
            contract = this.contractService.findOne(contractId);
            Precondition.checkSqdsArguement(contract != null, "数据错误，请重试！");
            contractList.add(contract);
        } else if (type == 2) {
            Precondition.checkSqdsArguement(zsProjectId != 0, "数据错误!");
        }

        if (StringUtils.isNotEmpty(preChooseDate)) {//批量打印
            contractList = this.contractService.getContractListByZsProjectIdAndPreChooseDate(zsProjectId, preChooseDate);
        }

        Precondition.checkSqdsArguement(contractList.size() > 0, "无协议!");
        Map map = Maps.newHashMap();
        map.put("contractList", contractList);
        map.put("groupMap", groupMap);
        map.put("intUtils", new IntegerUtils());
        map.put("strUtils", new StringUtils());
        String template = this.getPdfUrl(contractList.get(0), "chooseHouseReviewTablePDF.html");
        this.commonPrintPDF(map, template, response);
    }

    /**
     * 安置流程卡打印
     *
     * @param request
     */
    @RequestMapping("resetProcessCardPDF")
    @RequiresPermissions("print:resetProcessCardPDF")
    public void resetProcessCardPDF(HttpServletRequest request, HttpServletResponse response) throws
            Exception, InvocationTargetException, NoSuchMethodException, NoSuchFieldException, IllegalAccessException {
        int type = ParamUtils.getInt(request, "type", 0);
        String preChooseDate = ParamUtils.getString(request, "preChooseDate", "");
        int zsProjectId = ParamUtils.getInt(request, "zsProjectId", 0);
        int contractId = ParamUtils.getInt(request, "contractId", 0);

        Contract contract = null;
        List<Contract> contractList = new ArrayList<>();//待打印的基础信息list
        if (type == 1) {//单独打印
            contract = this.contractService.findOne(contractId);
            Precondition.checkSqdsArguement(contract != null, "数据错误，请重试！");
            contractList.add(contract);
        } else if (type == 2) {
            Precondition.checkSqdsArguement(zsProjectId != 0, "数据错误!");
        }

        if (StringUtils.isNotEmpty(preChooseDate)) {//批量打印
            contractList = this.contractService.getContractListByZsProjectIdAndPreChooseDate(zsProjectId, preChooseDate);
        }

        Precondition.checkSqdsArguement(contractList.size() > 0, "无协议!");
        Map map = Maps.newHashMap();
        map.put("contractList", contractList);
        map.put("strUtils", new StringUtils());
        map.put("intUtils", new IntegerUtils());

        String template = this.getPdfUrl(contractList.get(0), "resetProcessCardPDF.html");
        this.commonPrintPDF(map, template, response);
    }

    /**
     * 打印结清凭证
     *
     * @param request
     */
    @RequestMapping("settleVoucherPDF")
    @RequiresPermissions("print:settleVoucherPDF")
    public void settleVoucherPDF(HttpServletRequest request, HttpServletResponse response) throws
            Exception, InvocationTargetException, NoSuchMethodException, NoSuchFieldException, IllegalAccessException {
        int contractId = ParamUtils.getInt(request, "contractId", 0);
        String houseIdStr = ParamUtils.getString(request, "houseIdStr", "");
        String carLotIdStr = ParamUtils.getString(request, "carLotIdStr", "");
        String storageRoomIdStr = ParamUtils.getString(request, "storageRoomIdStr", "");
        String shopHouseIdStr = ParamUtils.getString(request, "shopHouseIdStr", "");
        Contract contract = this.contractService.findOne(contractId);
        Precondition.checkSqdsArguement(contract != null, "数据有误！");
        List<House> houseList = Lists.newLinkedList();
        List<StorageRoom> storageRoomList = Lists.newLinkedList();
        List<CarLot> carLotList = Lists.newLinkedList();
        List<ShopHouse> shopHouseList = Lists.newLinkedList();
        houseList = this.houseService.getHouseListByContractId(contract.getId());
        storageRoomList = this.storageRoomService.getStorageRoomListByContractId(contract.getId());
        carLotList = this.carLotService.getCarLotListByContractId(contract.getId());
        shopHouseList = this.shopHouseService.getShopHouseListByContractId(contract.getId());

        Map<String, DataDict> handInMoneyMap = this.dataDictService.getMapByParentNameForValue("缴款类别");
        List<HandInMoney> handInMoneyList = this.handInMoneyService.getHandInMoneyListByContractId(contractId);

        Map map = Maps.newHashMap();
        map.put("contract", contract);
        map.put("houseList", houseList);
        map.put("storageRoomList", storageRoomList);
        map.put("carLotList", carLotList);
        map.put("shopHouseList", shopHouseList);
        map.put("bigUtils", new BigDecimalUtils());
        map.put("intUtils", new IntegerUtils());
        map.put("strUtils", new StringUtils());
        map.put("moneyUtils", new MoneyUtils());
        map.put("handInMoneyMap", handInMoneyMap);
        map.put("handInMoneyList", handInMoneyList);

        //缴款清单
        String template = this.getPdfUrl(contract, "settleVoucherPDF.html");
        this.commonPrintPDF(map, template, response);
    }

    /**
     * 打印户型清单
     *
     * @param request
     */
    @RequestMapping("houseTypeListPDF")
    @RequiresPermissions("print:houseTypeListPDF")
    public void houseTypeListPDF(HttpServletRequest request, HttpServletResponse response) throws
            Exception, InvocationTargetException, NoSuchMethodException, NoSuchFieldException, IllegalAccessException {
        int contractId = ParamUtils.getInt(request, "contractId", 0);
        String houseIdStr = ParamUtils.getString(request, "houseIdStr", "");
        String carLotIdStr = ParamUtils.getString(request, "carLotIdStr", "");
        String storageRoomIdStr = ParamUtils.getString(request, "storageRoomIdStr", "");
        String shopHouseIdStr = ParamUtils.getString(request, "shopHouseIdStr", "");
        Contract contract = this.contractService.findOne(contractId);
        Precondition.checkSqdsArguement(contract != null, "数据有误！");
        List<House> houseList = Lists.newLinkedList();
        List<StorageRoom> storageRoomList = Lists.newLinkedList();
        List<CarLot> carLotList = Lists.newLinkedList();
        List<ShopHouse> shopHouseList = Lists.newLinkedList();
        //如果没有选择，则显示所有房源、储物间、车位
        if (houseIdStr.equals("") && carLotIdStr.equals("") && storageRoomIdStr.equals("")  && shopHouseIdStr.equals("")) {
            houseList = this.houseService.getHandInMoneyHouseListByContractId(contract.getId());
            storageRoomList = this.storageRoomService.getStorageRoomListByContractId(contract.getId());
            carLotList = this.carLotService.getHandInMoneyCarLotListByContractId(contract.getId());
            shopHouseList = this.shopHouseService.getHandInMoneyShopHouseListByContractId(contract.getId());
        } else {
            if (houseIdStr.length() > 0) {
                houseList = this.houseService.getHouseListByIds(houseIdStr);
            }
            if (carLotIdStr.length() > 0) {
                carLotList = this.carLotService.getCarLotListByIds(carLotIdStr);
            }
            if (storageRoomIdStr.length() > 0) {
                storageRoomList = this.storageRoomService.getStorageRoomListByIds(storageRoomIdStr);
            }
            if (shopHouseIdStr.length() > 0) {
                shopHouseList = this.shopHouseService.getShopHouseListByIds(shopHouseIdStr);
            }
        }

        Map map = Maps.newHashMap();
        map.put("contract", contract);
        map.put("houseList", houseList);
        map.put("storageRoomList", storageRoomList);
        map.put("carLotList", carLotList);
        map.put("shopHouseList", shopHouseList);
        map.put("bigUtils", new BigDecimalUtils());
        map.put("intUtils", new IntegerUtils());
        map.put("strUtils", new StringUtils());
        Map<String, List<Map>> buyHousePersonHouseMap = this.buyHousePersonService.getBuyHousePersonByHouse();
        Map<String, List<Map>> buyHousePersonCarLotMap = this.buyHousePersonService.getBuyHousePersonByCarLot();
        Map<String, List<Map>> buyHousePersonStorageRoomMap = this.buyHousePersonService.getBuyHousePersonByStorageRoom();
        Map<String, List<Map>> buyHousePersonShopHouseMap = this.buyHousePersonService.getBuyHousePersonByShopHouse();
        map.put("buyHousePersonHouseMap", buyHousePersonHouseMap);
        map.put("buyHousePersonCarLotMap", buyHousePersonCarLotMap);
        map.put("buyHousePersonStorageRoomMap", buyHousePersonStorageRoomMap);
        map.put("buyHousePersonShopHouseMap", buyHousePersonShopHouseMap);

        //缴款清单
        String template = this.getPdfUrl(contract, "houseTypeListPDF.html");
        this.commonPrintPDF(map, template, response);
    }


    /**
     * 物业申请表打印
     *
     * @param request
     */
    @RequestMapping("housePersonForPropertyPrint")
    @RequiresPermissions("print:housePersonForPropertyPrint")
    public void housePersonForPropertyPrint(HttpServletRequest request, HttpServletResponse response) throws
            Exception, InvocationTargetException, NoSuchMethodException, NoSuchFieldException, IllegalAccessException {
        int houseId = ParamUtils.getInt(request, "houseId", 0);
        House house = this.houseService.findOne(houseId);
        Precondition.checkSqdsArguement(house != null, "房源数据有误！");
        List<HousePersonForProperty> housePersonForPropertyList = this.housePersonForPropertyServicese.getHousePersonListByHouseId(house.getId());
        List<BuyHousePerson> buyHousePersonList = this.buyHousePersonService.getBuyHousePersonListByHouseId(house.getId());
        Map map = Maps.newHashMap();
        String buyHousePersonName = "";
        String buyHousePersonIdCard = "";
        String buyHousePersonTel = "";
        if (!CollectionUtils.isEmpty(buyHousePersonList)) {
            for (BuyHousePerson buyHousePerson : buyHousePersonList) {
                if (buyHousePersonList.size() - 1 == buyHousePersonList.indexOf(buyHousePerson)) {

                    buyHousePersonName = buyHousePersonName + buyHousePerson.getName();
                    buyHousePersonIdCard = buyHousePersonIdCard + buyHousePerson.getIdCard();
                } else {
                    buyHousePersonName = buyHousePersonName + buyHousePerson.getName() + "、";
                    buyHousePersonIdCard = buyHousePersonIdCard + buyHousePerson.getIdCard() + "、";
                }
            }
            map.put("housePersonName", buyHousePersonName);
            map.put("buyHousePersonIdCard", buyHousePersonIdCard);

        }
        map.put("housePersonForPropertyList", housePersonForPropertyList);
        map.put("buyHousePersonList", buyHousePersonList);
        map.put("house", house);

        map.put("strUtils", new StringUtils());
        map.put("bigUtils", new BigDecimalUtils());

        String template = this.getPdfUrl(house.getContract(), "housePersonForProPertyPrintPDF.html");
        this.commonPrintPDF(map, template, response);
    }


    /**
     * 授权委托书
     *
     * @param request
     */
    @RequestMapping("trustPrint")
    @RequiresPermissions("print:trustPrint")
    public void trustPrint(HttpServletRequest request, HttpServletResponse response) throws
            Exception, InvocationTargetException, NoSuchMethodException, NoSuchFieldException, IllegalAccessException {
        int contractId = ParamUtils.getInt(request, "contractId", 0);
        Contract contract = this.contractService.findOne(contractId);
        Precondition.checkSqdsArguement(contract != null, "数据有误！");
        Map map = Maps.newHashMap();
        map.put("contract", contract);
        map.put("area", contract.getLimitHouseAreaTotal());
        map.put("bigUtils", new BigDecimalUtils());
        map.put("intUtils", new IntegerUtils());
        map.put("strUtils", new StringUtils());

        //授权委托书
        String template = this.getPdfUrl(contract, "trustPDF.html");
        this.commonPrintPDF(map, template, response);
    }

    /**
     * 安置选房审批表
     *
     * @param request
     */
    @RequestMapping("xfSpPrint")
    @RequiresPermissions("print:xfSpPrint")
    public void xfSpPrint(HttpServletRequest request, HttpServletResponse response) throws
            Exception, InvocationTargetException, NoSuchMethodException, NoSuchFieldException, IllegalAccessException {
        int contractId = ParamUtils.getInt(request, "contractId", 0);
        Contract contract = this.contractService.findOne(contractId);
        List<BuyHousePerson> buyHousePersonList = this.buyHousePersonService.getBuyHousePersonListByContractId(contractId);//

        Precondition.checkSqdsArguement(contract != null, "数据有误！");
        Map map = Maps.newHashMap();
        map.put("contract", contract);
        map.put("buyHousePersonList", buyHousePersonList);
        map.put("bigUtils", new BigDecimalUtils());
        map.put("intUtils", new IntegerUtils());
        map.put("strUtils", new StringUtils());

        //安置选房审批表
        String template = this.getPdfUrl(contract, "xfSpPrintPDF.html");
        this.commonPrintPDF(map, template, response);
    }


    /**
     * 安置房分配表
     *
     * @param request
     */
    @RequestMapping("houseFpPrint")
    @RequiresPermissions("print:houseFpPrint")
    public void houseFpPrint(HttpServletRequest request, HttpServletResponse response) throws
            Exception, InvocationTargetException, NoSuchMethodException, NoSuchFieldException, IllegalAccessException {
        int contractId = ParamUtils.getInt(request, "contractId", 0);
        Contract contract = this.contractService.findOne(contractId);
        List<House> houseList = this.houseService.getHouseListByContractId(contractId);
        List<StorageRoom> storageRoomList = this.storageRoomService.getStorageRoomListByContractId(contractId);
        List<CarLot> carLotList = this.carLotService.getCarLotListByContractId(contractId);

        Map<String, List<Map>> buyHousePersonHouseMap = this.buyHousePersonService.getBuyHousePersonByHouse();
        Map<String, List<Map>> buyHousePersonCarLotMap = this.buyHousePersonService.getBuyHousePersonByCarLot();
        Map<String, List<Map>> buyHousePersonStorageRoomMap = this.buyHousePersonService.getBuyHousePersonByStorageRoom();

        Precondition.checkSqdsArguement(contract != null, "数据有误！");
        Map map = Maps.newHashMap();
        map.put("contract", contract);
        map.put("houseList", houseList);
        map.put("storageRoomList", storageRoomList);
        map.put("carLotList", carLotList);
        map.put("size", houseList.size() + storageRoomList.size() + carLotList.size());
        map.put("buyHousePersonHouseMap", buyHousePersonHouseMap);
        map.put("buyHousePersonCarLotMap", buyHousePersonCarLotMap);
        map.put("buyHousePersonStorageRoomMap", buyHousePersonStorageRoomMap);
        map.put("bigUtils", new BigDecimalUtils());
        map.put("intUtils", new IntegerUtils());
        map.put("strUtils", new StringUtils());

        //安置选房审批表
        String template = this.getPdfUrl(contract, "houseFpPrintPDF.html");
        this.commonPrintPDF(map, template, response);
    }


    /**
     * 契税表打印
     *
     * @param request
     */
    @RequestMapping("deedTaxPrint")
    @RequiresPermissions("print:deedTaxPrint")
    public void deedTaxPrint(HttpServletRequest request, HttpServletResponse response) throws
            Exception, InvocationTargetException, NoSuchMethodException, NoSuchFieldException, IllegalAccessException {
        int contractId = ParamUtils.getInt(request, "contractId", 0);
        Contract contract = this.contractService.findOne(contractId);

        List<House> houseList = this.houseService.getHouseListNoSpByContractId(contractId);
        List<StorageRoom> storageRoomList = this.storageRoomService.getStorageRoomListByContractId(contractId);
        List<CarLot> carLotList = this.carLotService.getCarLotListByContractId(contractId);

        Map<String, List<Map>> buyHousePersonHouseMap = this.buyHousePersonService.getBuyHousePersonByHouse();
        Map<String, List<Map>> buyHousePersonCarLotMap = this.buyHousePersonService.getBuyHousePersonByCarLot();
        Map<String, List<Map>> buyHousePersonStorageRoomMap = this.buyHousePersonService.getBuyHousePersonByStorageRoom();

        Precondition.checkSqdsArguement(contract != null, "数据有误！");
        Map map = Maps.newHashMap();
        map.put("contract", contract);
        map.put("houseList", houseList);
        map.put("storageRoomList", storageRoomList);
        map.put("carLotList", carLotList);

        map.put("areaList", AreaAndPriceUtils.getAreaAndPriceList(contract));
        map.put("size", AreaAndPriceUtils.getAreaAndPriceList(contract).size());
        map.put("bigUtils", new BigDecimalUtils());
        map.put("intUtils", new IntegerUtils());
        map.put("strUtils", new StringUtils());
        map.put("buyHousePersonHouseMap", buyHousePersonHouseMap);
        map.put("buyHousePersonCarLotMap", buyHousePersonCarLotMap);
        map.put("buyHousePersonStorageRoomMap", buyHousePersonStorageRoomMap);

        BigDecimal noSpfArea = houseService.getNoSpfArea(contractId);
        map.put("noSpfArea",noSpfArea);

        String template = this.getPdfUrl(contract, "deedTaxPrintPDF.html");
        this.commonPrintPDF(map, template, response);
    }

    /**
     * 契税四方会签打印
     *
     * @param request
     */
    @RequestMapping("deedTaxFourPrint")
    @RequiresPermissions("print:deedTaxFourPrint")
    public void deedTaxFourPrint(HttpServletRequest request, HttpServletResponse response) throws
            Exception, InvocationTargetException, NoSuchMethodException, NoSuchFieldException, IllegalAccessException {
        int contractId = ParamUtils.getInt(request, "contractId", 0);
        Contract contract = this.contractService.findOne(contractId);
        List<House> houseList = this.houseService.getHouseListNoSpByContractId(contractId);
        List<StorageRoom> storageRoomList = this.storageRoomService.getStorageRoomListByContractId(contractId);
        List<CarLot> carLotList = this.carLotService.getCarLotListByContractId(contractId);

        Map<String, List<Map>> buyHousePersonHouseMap = this.buyHousePersonService.getBuyHousePersonByHouse();
        Map<String, List<Map>> buyHousePersonCarLotMap = this.buyHousePersonService.getBuyHousePersonByCarLot();
        Map<String, List<Map>> buyHousePersonStorageRoomMap = this.buyHousePersonService.getBuyHousePersonByStorageRoom();

        String azProjectNamelistStr = this.buyHousePersonService.azProjectName(contractId);

        //所属安置区名称str

        Precondition.checkSqdsArguement(contract != null, "数据有误！");
        Map map = Maps.newHashMap();
        map.put("azProjectNamelistStr", azProjectNamelistStr);
        map.put("contract", contract);
        map.put("houseList", houseList);
        map.put("storageRoomList", storageRoomList);
        map.put("carLotList", carLotList);
        map.put("size", houseList.size() + storageRoomList.size() + carLotList.size());
        map.put("buyHousePersonHouseMap", buyHousePersonHouseMap);
        map.put("buyHousePersonCarLotMap", buyHousePersonCarLotMap);
        map.put("buyHousePersonStorageRoomMap", buyHousePersonStorageRoomMap);
        map.put("bigUtils", new BigDecimalUtils());
        map.put("intUtils", new IntegerUtils());
        map.put("strUtils", new StringUtils());
        map.put("dateUtils", new DateUtils());
        BigDecimal noSpfArea = houseService.getNoSpfArea(contractId);
        map.put("noSpfArea",noSpfArea);

        String template = this.getPdfUrl(contract, "deedTaxFourPrintPDF.html");
        this.commonPrintPDF(map, template, response);
    }

    /**
     * 契税四方会签打印
     *
     * @param request
     */
    @RequestMapping("deedTaxForTaxDepartmentPrint")
    @RequiresPermissions("print:deedTaxForTaxDepartmentPrint")
    public void deedTaxForTaxDepartmentPrint(HttpServletRequest request, HttpServletResponse response) throws
            Exception, InvocationTargetException, NoSuchMethodException, NoSuchFieldException, IllegalAccessException {
        int contractId = ParamUtils.getInt(request, "contractId", 0);
        Contract contract = this.contractService.findOne(contractId);
        List<House> houseList = this.houseService.getHouseListNoSpByContractId(contractId);
        List<StorageRoom> storageRoomList = this.storageRoomService.getStorageRoomListByContractId(contractId);
        List<CarLot> carLotList = this.carLotService.getCarLotListByContractId(contractId);

        Map<String, List<Map>> buyHousePersonHouseMap = this.buyHousePersonService.getBuyHousePersonByHouse();
        Map<String, List<Map>> buyHousePersonCarLotMap = this.buyHousePersonService.getBuyHousePersonByCarLot();
        Map<String, List<Map>> buyHousePersonStorageRoomMap = this.buyHousePersonService.getBuyHousePersonByStorageRoom();

        String azProjectNamelistStr = this.buyHousePersonService.azProjectName(contractId);

        //所属安置区名称str

        Precondition.checkSqdsArguement(contract != null, "数据有误！");
        Map map = Maps.newHashMap();
        map.put("azProjectNamelistStr", azProjectNamelistStr);
        map.put("contract", contract);
        map.put("houseList", houseList);
        map.put("storageRoomList", storageRoomList);
        map.put("carLotList", carLotList);
        map.put("size", houseList.size() + storageRoomList.size() + carLotList.size());
        map.put("buyHousePersonHouseMap", buyHousePersonHouseMap);
        map.put("buyHousePersonCarLotMap", buyHousePersonCarLotMap);
        map.put("buyHousePersonStorageRoomMap", buyHousePersonStorageRoomMap);
        map.put("bigUtils", new BigDecimalUtils());
        map.put("intUtils", new IntegerUtils());
        map.put("strUtils", new StringUtils());
        map.put("dateUtils", new DateUtils());
        BigDecimal noSpfArea = houseService.getNoSpfArea(contractId);
        map.put("noSpfArea",noSpfArea);

        String template = this.getPdfUrl(contract, "deedTaxForTaxDepartmentPrintPDF.html");
        this.commonPrintPDF(map, template, response);
    }

    //***********************************************************************************

    /**
     * 文本模板核对
     *
     * @param request
     */
    @RequestMapping("checkPrintPdf")
    @RequiresPermissions("print:checkPrintPdf")
    public void checkPrintPdf(HttpServletRequest request, HttpServletResponse response) throws
            Exception, InvocationTargetException, NoSuchMethodException, NoSuchFieldException, IllegalAccessException {
        Map<String, DataDict> groupMap = this.dataDictService.getMapByParentNameForValue("组别");
        Map<String, DataDict> carLotTypeMap = this.dataDictService.getMapByParentNameForValue("车位类型");
        Map<String, DataDict> handInMoneyMap = this.dataDictService.getMapByParentNameForValue("缴款类别");
        DateUtils dateUtils = new DateUtils();

        int zsProjectId = ParamUtils.getInt(request, "zsProjectId", 0);
        String str = ParamUtils.getString(request, "str", "");

        ZsProject zsProject = this.zsProjectService.findOne(zsProjectId);
        Precondition.checkSqdsArguement(zsProject != null, "数据有误！");
        Contract contract = new Contract();
        contract.setZsProject(zsProject);
        List<Contract> contractList = new ArrayList<>();
        contractList.add(contract);
        AzProject azProject = new AzProject();
        House house = new House();
        StorageRoom storageRoom = new StorageRoom();
        CarLot carLot = new CarLot();
        List<BuyHousePerson> buyHousePersonList = new ArrayList<>();
        Integer size = 0;
        List<HandInMoney> handInMoneyList = new ArrayList<>();
        Map<String, Map> overHouseMoneyMap = this.overAreaPriceNewService.getOverHouseMoneyMapForMore(contract);
        //住宅过渡补助费标准
        String gdbzPrice = BigDecimalUtils.getNotNullStr(BigDecimalUtils.getBigAndBigMul(new BigDecimal("2"), zsProject.getGdbzPrice()));
        Map map = Maps.newHashMap();
        map.put("zsProject", zsProject);
        map.put("overHouseMoneyMap", overHouseMoneyMap);
        map.put("contract", contract);
        map.put("azProject", azProject);
        map.put("house", house);
        map.put("storageRoom", storageRoom);
        map.put("carLot", carLot);
        map.put("contractList", contractList);
        map.put("buyHousePersonList", buyHousePersonList);
        map.put("contractList", contractList);
        map.put("groupMap", groupMap);
        map.put("carLotTypeMap", carLotTypeMap);
        map.put("size", size);
        map.put("bigUtils", new BigDecimalUtils());
        map.put("intUtils", new IntegerUtils());
        map.put("strUtils", new StringUtils());
        map.put("moneyUtils", new MoneyUtils());
        map.put("gdbzPrice", gdbzPrice);
        map.put("handInMoneyList", handInMoneyList);
        map.put("handInMoneyMap", handInMoneyMap);


        String template = "";
        String pdfUrl = zsProject.getProjectCode() + "/" + str + ".html";
        template = pdfUrl;
        this.commonPrintPDF(map, template, response);
    }
}
